<?php

namespace app\common\service\order\coupon_order\jutuike_channel;

use app\model\CouponBrand;
use think\facade\Log;

/**
 * 用于记录没有保存的供应商信息
 */
class ActivityUnion extends Union
{
    public function getServType()
    {
        $this->processSid();

        if (!empty($this->couponOrderSid)) {
            if (!empty($this->couponOrderSid->serv_type)) {
                return $this->couponOrderSid->serv_type;
            }
        }

        $arr = CouponBrand::query()
            ->where('belong', CouponBrand::BELONG_JUTUIKE)
            ->cache('CouponBrandbelongcache',130)
            ->whereNotNull('serv_type')
            ->column('serv_type', 'act_id');

        if (empty($this->params['act_id'])) return '';

        if ($this->params['act_id'] == 50) return '';

        if (empty($arr[$this->params['act_id']]) && $this->params['act_id'] != 50) {//会员卡券单独处理
            Log::error('没有找到相对应的act_id:' . $this->params['act_id']);
            return '';
        };
        if (empty($arr[$this->params['act_id']])){
            Log::error('沒有配置相对应的act_id:' . $this->params['act_id']);
            return '';
        }
        return $arr[$this->params['act_id']];
    }
}